﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Archives.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return Redirect("/Apps/Archives/index.html#/index");
        }

        public ActionResult ShowHistory()
        {
            /*
             * 参数获取
             */
            // 科室ID
            var deptID = Request.Params["deptID"];
            // 超时时长
            var delayTime = Request.Params["delayTime"];
            // 开始日期
            var startTime = Request.Params["startTime"];
            // 结束日期
            var endTime = Request.Params["endTime"];

            /*
             * 参数校验
             */
            // 科室ID
            if(string.IsNullOrEmpty(deptID))
            {
                return RedirectToAction("Index");
            }
            else
            {
                ViewBag.deptID = deptID;
                ViewBag.delayTime = delayTime;
                ViewBag.startTime = startTime == "null" ? string.Empty : startTime;
                ViewBag.endTime = endTime == "null" ? string.Empty : endTime;
                return PartialView("~/App/deptMonitor.cshtml");
            }
        }
    }
}